From 24ed2f8aa11c674f1a507200945a9b4f20ce3069 Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Mon, 5 Apr 2010 18:01:56 -0400 Subject: [PATCH] Fixed 2 bugs in gtk_box_size_allocate() This commit fixes the loop to take into consideration the child->padding that will be allocated to the child while calculating full available size. Additionally it fixes the initial positioning of child widgets when packed at the end (a special case because the x position used starts from the end of the box). --- gtk/gtkbox.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index 61f237bc44..d3fc2ed7d9 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -470,7 +470,6 @@ gtk_box_size_allocate (GtkWidget *widget, else { /* Retrieve desired size for visible children */ - i = 0; children = box->children; while (children) @@ -492,6 +491,7 @@ gtk_box_size_allocate (GtkWidget *widget, &sizes[i].natural_size); size -= sizes[i].minimum_size; + size -= child->padding * 2; spreading[i].index = i; spreading[i].child = child; @@ -627,14 +627,20 @@ gtk_box_size_allocate (GtkWidget *widget, child_allocation.width = sizes[i].minimum_size; child_allocation.x = x + (child_size - child_allocation.width) / 2; } - + if (direction == GTK_TEXT_DIR_RTL) child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width; if (packing == GTK_PACK_START) - x += child_size + box->spacing; + { + x += child_size + box->spacing; + } else - x -= child_size + box->spacing; + { + x -= child_size + box->spacing; + + child_allocation.x -= child_allocation.width; + } } else { @@ -650,9 +656,15 @@ gtk_box_size_allocate (GtkWidget *widget, } if (packing == GTK_PACK_START) - y += child_size + box->spacing; + { + y += child_size + box->spacing; + } else - y -= child_size + box->spacing; + { + y -= child_size + box->spacing; + + child_allocation.y -= child_allocation.height; + } } gtk_widget_size_allocate (child->widget, &child_allocation); -- 2.30.2